import { ref,  watch,  watchEffect } from "vue"

export default function(title='默认首页') {
  const titleRef=ref(title)

  // watchEffect(()=>{
  //   document.title=titleRef.value
  // })

  watch(titleRef,(newVal)=>{
    document.title=newVal
  },{immediate:true})  //immediate:true立即执行初次赋值的时候就触发
  return titleRef
}